package Genericity;

public class Genericity_01 {


    public static void main(String[] args) {
            String[] names={"a","b","c"};
            printArray(names);
            Integer[] ages={1,2,3};
            printArray(ages);
    }


    public static <T> void printArray(T[] arr){
       
        if (arr!=null)
        {
            StringBuilder sb = new StringBuilder("[");
            for (int i=0;i<arr.length;i++) {
                sb.append(arr[i]).append(i==arr.length-1?"":", ");
            }
            sb.append("]");
            System.out.println(sb);
        }else {
            System.out.println(arr);
        }
    }
}
